package com.myzombieapocalypse.projectz.domain.hibernate;

import com.myzombieapocalypse.projectz.domain.Account;
import com.myzombieapocalypse.projectz.domain.AccountDAO;
import org.hibernate.criterion.Restrictions;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import java.util.List;

/**
 * User: StuartS
 * Date: 23/10/11
 * Time: 18:25
 */
public class HibernateAccountDAO extends AbstractHibernateDAO<Account> implements AccountDAO{

    public Account getByEmailAndPassword(String email, String password) {
        return (Account)getSession()
                .createCriteria(Account.class)
                .add(Restrictions.eq("email",email))
                .add(Restrictions.eq("password", password))
                .uniqueResult();
    }
}
